package model;

import java.util.List;
import java.util.UUID;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;

@XmlType(propOrder = { "carddeck", "name"})
public class CardDeck {

	
	List<Card> carddeck = null;
	String name = null;
	
	public Card getCard(UUID id){
		if(this.carddeck == null)
			//TODO: lade den Kram
		for(Card elem : carddeck){
			if(elem.getId() == id)
				return elem;
		}
		return null;
	}

	@XmlElementWrapper(name = "cards")
	@XmlElement(name = "card")
	public List<Card> getCarddeck() {
		return carddeck;
	}

	public void setCarddeck(List<Card> carddeck) {
		this.carddeck = carddeck;
	}
	
	public boolean setsingleCard(Card card){
		if(carddeck == null || carddeck.isEmpty()){
			return false;
		} else {
			carddeck.add(card);
			return true;
		}
	}
	
	@XmlElement(name = "deckname")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
}
